<template>
    <div class="box">
        <div v-if="question" style="margin-bottom:20px">
            <el-radio v-model="typeValue" label="1">砂锅问答</el-radio>
            <el-radio v-model="typeValue" label="2">砂锅号</el-radio>
        </div>
        <el-input
            v-model="inputValue"
            placeholder="请输入关键词"
            prefix-icon="el-icon-search"
            @keyup.native.enter="e=>e.target.blur()"
            @blur="Blur"
        />
        <div class="btn-group">
            <el-button type="primary" @click="Emit('add')">新增</el-button>
            <el-button type="success" @click="Emit('export')">导出选中</el-button>
            <el-button type="warning" @click="Emit('exportAll')">导出全部</el-button>
            <!-- <el-button type="" @click="Emit('import')">Excel导入</el-button> -->
            <el-button type="danger" @click="Emit('del')">批量删除</el-button>
        </div>
    </div>
</template>

<script>
export default {
    components: {

    },
    props: {
        question: Boolean,
        input: String,
        type: String
    },
    data () {
        return {
            typeValue: '1',
            inputValue: null
        }
    },
    computed: {

    },
    watch: {
        inputValue (val) {
            this.$emit('update:input', val)
        },
        typeValue (val) {
            this.$emit('update:type', val)
        }
    },
    created () {

    },
    mounted () {

    },
    methods: {
        Emit (name) {
            this.$emit('click', name)
        },
        Blur (e) {
            console.log(e)
            e.target.blur()
            this.$emit('change', this.input)
        }
    }
}
</script>

<style scoped lang="stylus">
.box
    padding 20px 0
.el-input
    width 206px
.btn-group
    float right

</style>
